/**
 * Created by lixiaodi on 2018/11/12.
 */
mini.parse();

var grid = mini.get("grid1");

//动态设置URL
//grid.setUrl("http://192.168.178.103:8080/report/reportController/list.do");
//编辑
function SetData(data) {
    //跨页面传递的数据对象，克隆后才可以安全使用
    data = mini.clone(data);
    //判断状态是编辑还是新增
    if (data.action == "new") {
        console.log("new");
    }else if(data.action == "edit"){
        var reporIds = data.id;
        var obj = {
            reportId : reporIds,
            paramSql : "",
            sortFiledVal : "",
            sortOrder : ""
        }
        var jsonSring = JSON.stringify(obj);
        $.ajax({
            url: ajaxUrl + "/reportController/list.do",
            type:"post",
            contentType:"application/json",
            data : jsonSring,
            success: function (data) {
                var reportData = data.columnCnType; //表格列数据/内容数据
                for(var i = 0; i < reportData.length; i++){
                    reportData[i].column_name =reportData[i].column_name.split("$")[0]+"."+reportData[i].column_name.split("$")[1];
                }
                grid.setData(reportData);
            }
        });
    }
}
//也可以动态设置列 grid.setColumns([]);
grid.load();
//得到被选择的列
function GetData() {
    var row = grid.getSelected();
    return row;
}
function onRowDblClick(e) {
    onOk();
}
//关闭子页面
function CloseWindow(action) {
    if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
    else window.close();
}

function onOk() {
    CloseWindow("ok");
}
function onCancel() {
    CloseWindow("cancel");
}

